package projetolp2.GraphicInterface;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

@SuppressWarnings("serial")
public class SugestoesPersonalizadas extends MealPoints implements ActionListener{
	
	private JPanel panelMenu = new JPanel(new BorderLayout());
	private JPanel panel0= new JPanel(new GridLayout(0, 1));
	private JPanel panel1 = new JPanel(new GridLayout(0, 1));
	private JPanel panel2= new JPanel(new GridLayout(0, 1));
	private JPanel panel3= new JPanel(new GridLayout(0, 1));
	private JPanel panel4= new JPanel(new GridLayout(0, 1));
	private JPanel panel5= new JPanel(new GridLayout(0, 1));
	private JPanel panel6= new JPanel(new GridLayout(0, 1));
	private JButton TIPO = new JButton(NomeBotoes.values()[idioma(IDIOMAPROGRAMA )].getTipo());
	private JButton SERVICO = new JButton(NomeBotoes.values()[idioma(IDIOMAPROGRAMA )].getServico());
	private JButton USUARIO = new JButton(NomeBotoes.values()[idioma(IDIOMAPROGRAMA )].getUsuario());
	private JButton VOLTAR = new JButton(NomeBotoes.values()[idioma(IDIOMAPROGRAMA )].getVoltar());
	private JButton LOCAL = new JButton(NomeBotoes.values()[idioma(IDIOMAPROGRAMA )].getLocal());
	private JButton FILTRO = new JButton(NomeBotoes.values()[idioma(IDIOMAPROGRAMA )].getFiltro());
	final JLabel label = new JLabel("Escolha o tipo de sugestao: ");
	private JPanel panelFinal = new JPanel();
	private JPanel panelFinal1 = new JPanel();
	private JPanel panelFinal2 = new JPanel(new GridLayout(0, 1));
	JFrame janelaEscolhaTipo = new JFrame();
	
	public SugestoesPersonalizadas(){
		
	}
	private void ajudaDeBotoes(){
		TIPO.setToolTipText("Sugestões por tipo de restaurante");
		SERVICO.setToolTipText("Sugestões por tipo de servico prestado");
		USUARIO.setToolTipText("Sugestões de acordo com usu�rio escolhido");
		LOCAL.setToolTipText("Sugestões de estabelecimentos sobre determinado local");
		FILTRO.setToolTipText("Sugestões de estabelecimentos onde você escolhe o que você não quer");
		VOLTAR.setToolTipText("Voltar a janela anterior");
	}
	public void actionPerformed(ActionEvent e){
		if(e.getSource() == TIPO){
			removerAdicionar(sugestoespersonalizadas,sugestoesTipo);	
		}
		else if(e.getSource() == SERVICO){
			removerAdicionar(sugestoespersonalizadas,sugestoespersonalizadasPrato);	
		}
		else if(e.getSource() == USUARIO){
			removerAdicionar(sugestoespersonalizadas,((SugestoesUsuario) sugestoesUsuario).panel());
		}
		else if(e.getSource() == VOLTAR){
			removerAdicionar(sugestoespersonalizadas,sugestoes);	
		}
		else if(e.getSource() == LOCAL){
			janela.setEnabled(false);
			quantidadeSugestoes.abilitaDesabilita(true, "LO");
		}
		else if(e.getSource() == FILTRO){
			removerAdicionar(sugestoespersonalizadas,sugestoespersonalizadasFiltro);	
		}
	}
	private void createComponents() {
		ajudaDeBotoes();
		
		TIPO.setMnemonic(KeyEvent.VK_I);
		TIPO.addActionListener(this);
        label.setLabelFor(TIPO);
        
        SERVICO.setMnemonic(KeyEvent.VK_I);
        SERVICO.addActionListener(this);
        label.setLabelFor(SERVICO);
        
        USUARIO.setMnemonic(KeyEvent.VK_I);
        USUARIO.addActionListener(this);
        label.setLabelFor(USUARIO);
        
        VOLTAR.setMnemonic(KeyEvent.VK_I);
        VOLTAR.addActionListener(this);
        label.setLabelFor(VOLTAR);
        
        LOCAL.setMnemonic(KeyEvent.VK_I);
        LOCAL.addActionListener(this);
        label.setLabelFor(LOCAL);
        
        FILTRO.setMnemonic(KeyEvent.VK_I);
        FILTRO.addActionListener(this);
        label.setLabelFor(FILTRO);
        
        panel0.add(label);
        panel1.add(TIPO);
        panel2.add(SERVICO);
        panel5.add(LOCAL);
        panel3.add(USUARIO);
        panel4.add(VOLTAR);
        panel6.add(FILTRO);
        panel0.setBorder(BorderFactory.createEmptyBorder(
                5, //top
                10, //left
                5, //bottom
                10) //right
                );
        panel1.setBorder(BorderFactory.createEmptyBorder(
                5, //top
                10, //left
                5, //bottom
                10) //right
                );
        panel2.setBorder(BorderFactory.createEmptyBorder(
                5, //top
                10, //left
                5, //bottom
                10) //right
                );
        panel3.setBorder(BorderFactory.createEmptyBorder(
                5, //top
                10, //left
                5, //bottom
                10) //right
                );
        panel4.setBorder(BorderFactory.createEmptyBorder(
                5, //top
                10, //left
                5, //bottom
                10) //right
                );
        panel5.setBorder(BorderFactory.createEmptyBorder(
                5, //top
                10, //left
                5, //bottom
                10) //right
                );
        panel6.setBorder(BorderFactory.createEmptyBorder(
                5, //top
                10, //left
                5, //bottom
                10) //right
                );
        panelFinal1.add(panel0);
        panelFinal.add(panel1);
        panelFinal.add(panel2);
        panelFinal.add(panel5);
        panelFinal.add(panel3);
        panelFinal.add(panel6);
        panelFinal.add(panel4);
        panelFinal2.add(panelFinal1);
        panelFinal2.add(panelFinal);
        panelMenu.add(panelFinal2,BorderLayout.NORTH);
    }
	public Component panel(){
		createComponents();
		panelMenu.setBackground(Color.white);
		panelMenu.setVisible(true);
		
		
		return panelMenu;
	}	
}